#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import pickle
import socket
import time

# Connect to the server:
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('localhost', 2727))

# Retrieve and unpickle the list object:
print pickle.loads(client.recv(1024))

# Send some messages:
rg = range(10)
rg.reverse()
for x in rg:
    client.send('Time before disconnect : ' + str(x))
    time.sleep(1)

# Close the connection
client.close()